package com.steel.yfmall.cloud.assistant.impl;

import com.steel.yfmall.cloud.assistant.api.stock.SynchronizationZgAPI;
import com.steel.yfmall.cloud.assistant.dto.zg.ZgViewBean;
import com.steel.yfmall.cloud.assistant.po.view.*;
import com.steel.yfmall.cloud.assistant.utils.zg.ZgViewUtil;
import com.steel.yfmall.cloud.assistant.view.*;
import com.steel.yfmall.cloud.components.utils.base.APIMsgBean;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 同步中冠数据
 *
 * @author jia chang bao
 * @date 2021/1/5 17:06
 */
@Slf4j
@Service
public class SynchronizationZgAPIImpl implements SynchronizationZgAPI {

    /**
     * 同步 中冠 同步副產品單價 视图 sr04
     *
     * @return 同步成功信息数据
     * @author jia chang bao
     * @date 2021/1/5 15:47
     */
    @Override
    public APIMsgBean synchronizationZgReceivingGoods() {
        //设置同步参数
        ZgViewBean zgViewBean = new ZgViewBean();
        zgViewBean.setMethod(ZgViewUtil.GET_VIEW_NAME);
        zgViewBean.setPageNum("1");
        zgViewBean.setViewId(ZgViewUtil.BY_PRODUCE_PRICE_VIEW);
        zgViewBean.setParam(new ByProductPriceBean());
        return byProductPriceBeanService.synchronizationZgReceivingGoods(zgViewBean);
    }

    /**
     * 同步 中冠 终点代码 视图 sh02
     *
     * @return 同步成功信息数据
     * @author jia chang bao
     * @date 2021/1/5 15:47
     */
    @Override
    public APIMsgBean synchronizationZgEndCode() {
        ZgViewBean zgViewBean = new ZgViewBean();
        zgViewBean.setViewId(ZgViewUtil.END_PLICE_CODE_VIEW);
        zgViewBean.setMethod(ZgViewUtil.GET_VIEW_NAME);
        zgViewBean.setPageNum("1");
        zgViewBean.setParam(new EndCodeBean());
        return endCodeBeanService.synchronizationZgEndCode(zgViewBean);
    }

    /**
     * 同步中冠产品规范号信息 视图 tp04
     *
     * @return 同步成功信息数据
     * @author jia chang bao
     * @date 2021/1/5 15:47
     */
    @Override
    public APIMsgBean synchronizationZgGoodsStandardBean() {
        ZgViewBean zgViewBean = new ZgViewBean();
        zgViewBean.setMethod(ZgViewUtil.GET_VIEW_NAME);
        zgViewBean.setPageNum("1");
        zgViewBean.setViewId(ZgViewUtil.PRODUCT_SPECIFICATION_CODE);
        zgViewBean.setParam(new GoodsStandardBean());
        return goodsStandardBeanService.synchronizationZgGoodsStandardBean(zgViewBean);
    }

    /**
     * 根据电商已有产品形态进行商品同步 视图 ix01new
     *
     * @return 结果
     * @date 2021/1/5 15:47
     * @author jia chang bao
     */
    @Override
    public APIMsgBean<Integer> SyncGoodsTemplateBeanByLibFrom() {
        return goodsTemplateService.SyncGoodsTemplateBeanByLibFrom();
    }

    /**
     * 同步中冠产品大类、形态业务信息 视图 tp01
     *
     * @return 同步成功信息数据
     * @author jia chang bao
     * @date 2021/1/5 15:47
     */
    @Override
    public APIMsgBean synchronizationZgGoodsTypeBean() {
        ZgViewBean zgViewBean = new ZgViewBean();
        zgViewBean.setMethod(ZgViewUtil.GET_VIEW_NAME);
        zgViewBean.setPageNum("1");
        zgViewBean.setViewId(ZgViewUtil.PRODUCT_TYPE_FORM_VIEW);
        zgViewBean.setParam(new GoodsTypeBean());
        return goodsTypeBeanService.synchronizationZgGoodsTypeBean(zgViewBean);
    }

    /**
     * 同步中冠省市县邮政编码信息 视图 sh04
     *
     * @return 同步成功信息数据
     * @author jia chang bao
     * @date 2021/1/5 15:47
     */
    @Override
    public APIMsgBean synchronizationZgPostalCode() {
        ZgViewBean zgViewBean = new ZgViewBean();
        zgViewBean.setMethod(ZgViewUtil.GET_VIEW_NAME);
        zgViewBean.setPageNum("1");
        zgViewBean.setViewId(ZgViewUtil.POST_OFFICE_CODE_VIEW);
        zgViewBean.setParam(new PostalCodeBean());
        return postalCodeBeanService.synchronizationZgPostalCode(zgViewBean);
    }

    /**
     * 同步中冠终到地区信息 视图 sh03
     *
     * @return 同步成功信息数据
     * @author jia chang bao
     * @date 2021/1/5 15:47
     */
    @Override
    public APIMsgBean synchronizationZgReachRegion() {
        ZgViewBean zgViewBean = new ZgViewBean();
        zgViewBean.setMethod(ZgViewUtil.GET_VIEW_NAME);
        zgViewBean.setPageNum("1");
        zgViewBean.setViewId(ZgViewUtil.END_REGION_VIEW);
        zgViewBean.setParam(new ReachRegionBean());
        return reachRegionBeanService.synchronizationZgReachRegion(zgViewBean);
    }

    /**
     * 同步中冠收货人信息 视图 sb02
     *
     * @return 同步成功信息数据
     * @author jia chang bao
     * @date 2021/1/5 15:47
     */
    @Override
    public APIMsgBean synchronizationZgeCustomerSettlement() {
        ZgViewBean zgViewBean = new ZgViewBean();
        zgViewBean.setMethod(ZgViewUtil.GET_VIEW_NAME);
        zgViewBean.setPageNum("1");
        zgViewBean.setViewId(ZgViewUtil.CONSIGNEE_VIEW);
        zgViewBean.setParam(new ReceivingGoodsBean());
        return receivingGoodsBeanService.synchronizationZgeCustomerSettlement(zgViewBean);
    }

    /**
     * 同步中冠用途码信息 视图 tp03
     *
     * @return 同步成功信息数据
     * @author jia chang bao
     * @date 2021/1/5 15:47
     */
    @Override
    public APIMsgBean synchronizationZgUsageCodeBean() {
        ZgViewBean zgViewBean = new ZgViewBean();
        zgViewBean.setMethod(ZgViewUtil.GET_VIEW_NAME);
        zgViewBean.setPageNum("1");
        zgViewBean.setViewId(ZgViewUtil.USAGE_CODE_VIEW);
        zgViewBean.setParam(new UsageCodeBean());
        return usageCodeBeanService.synchronizationZgUsageCodeBean(zgViewBean);
    }

    /**
     * 副产品单价信息业务逻辑接口
     */
    @Resource
    private ByProductPriceBeanService byProductPriceBeanService;
    /**
     * 终点代码业务逻辑接口
     */
    @Resource
    private EndCodeBeanService endCodeBeanService;
    /**
     * 产品规范号信息接口
     */
    @Resource
    private GoodsStandardBeanService goodsStandardBeanService;
    @Resource
    private GoodsTemplateService goodsTemplateService;
    /**
     * 产品大类、形态信息业务逻辑接口
     */
    @Resource
    private GoodsTypeBeanService goodsTypeBeanService;
    /**
     * 省市县邮政编码 业务接口
     */
    @Resource
    private PostalCodeBeanService postalCodeBeanService;
    /**
     * 终到地区业务逻辑
     */
    @Resource
    private ReachRegionBeanService reachRegionBeanService;
    /**
     * 收货人管理数据
     */
    @Resource
    private ReceivingGoodsBeanService receivingGoodsBeanService;
    /**
     * 用途码信息
     */
    @Resource
    private UsageCodeBeanService usageCodeBeanService;
}
